package com.ruoyi.common.gscUtil.StudyUtil.MultiDataSourceUtil.DynamicSwitchingUtil;


/**
 * 2. 数据源上下文管理
 */
public class DataSourceContextHolder2 {
    private static final ThreadLocal<String> contextHolder = new ThreadLocal<>();

    public static void setDataSourceKey(String key) {
        contextHolder.set(key);
    }

    public static String getDataSourceKey() {
        return contextHolder.get();
    }

    public static void clearDataSourceKey() {
        contextHolder.remove();
    }
}